package com.xauto.pioneer.appuser.adapter;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.xauto.pioneer.appuser.R;
import com.xauto.pioneer.appuser.model.ParkingOrderInfo;

/**
 * Created by Lemon on 2015/12/11.
 * Desc:订单列表 适配器
 */
public class ParkingOrderAdapter extends AbsAdapter<ParkingOrderInfo> {

    public ParkingOrderAdapter(Activity context, int layout) {
        super(context, layout);
    }

    @Override
    public ViewHolder<ParkingOrderInfo> getHolder() {
        return new TemplateViewHolder();
    }


    private class TemplateViewHolder implements ViewHolder<ParkingOrderInfo> {

        private TextView tvParkingSite;
        private TextView tvParkingOrderAccount;
        private TextView tvParkingCarNum;
        private TextView tvParkingOrderTime;
        private TextView tvParkingOrderStart;
        private TextView tvParkingOrderEnd;

        @Override
        public void initViews(View v, int position) {
            tvParkingSite = (TextView) v.findViewById(R.id.tvParkingSite);
            tvParkingOrderAccount = (TextView) v.findViewById(R.id.tvParkingOrderAccount);
            tvParkingCarNum = (TextView) v.findViewById(R.id.tvParkingCarNum);
            tvParkingOrderTime = (TextView) v.findViewById(R.id.tvParkingOrderTime);
            tvParkingOrderStart = (TextView) v.findViewById(R.id.tvParkingOrderStart);
            tvParkingOrderEnd = (TextView) v.findViewById(R.id.tvParkingOrderEnd);
        }

        @Override
        public void updateData(ParkingOrderInfo parkingOrderInfo, int position) {
            tvParkingSite.setText(""+parkingOrderInfo.parking_order_location);
            tvParkingOrderAccount.setText(parkingOrderInfo.parking_order_price);
            tvParkingCarNum.setText(parkingOrderInfo.parking_order_carnum );
            tvParkingOrderTime.setText(parkingOrderInfo.parking_order_time);
            tvParkingOrderStart.setText(parkingOrderInfo.parking_order_start );
            tvParkingOrderEnd.setText(parkingOrderInfo.parking_order_end);
//            tvParkingOrderAccount.setText(context.getString(R.string.order_date,orderInfo.order_time_format));
//            tvParkingCarNum.setText(orderInfo.car_order_status_display_name );
//            tvParkingOrderTime.setText(context.getString(R.string.order_account,orderInfo.total_amount_format));
//            tvParkingCarNum.setText(orderInfo.car_order_status_display_name );
//            tvParkingOrderTime.setText(context.getString(R.string.order_account,orderInfo.total_amount_format));

        }

        @Override
        public void doOthers(ParkingOrderInfo orderInfo, int position) {

        }
    }
}
